package com.easipass.framework.eirframeworkstream;

import com.easipass.framework.eirframeworkbeanshell.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.support.MessageBuilder;

@EnableBinding(MessageProcess.class)
public class MessageService {

    @Autowired
    private MessageProcess messageProcess;

    public String sendSourceMessage(Message message) {
        return messageProcess.sendSourceMessage().send(MessageBuilder.withPayload(message).build()) ? "推送成功" : "推送失败";
    }

    public String sendSinkMessage(Message message) {
        return messageProcess.sendSinkMessage().send(MessageBuilder.withPayload(message).build()) ? "推送成功" : "推送失败";
    }
}
